#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back
#define vec vector<int>

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);return x*sgn;}

const int N = 310;

int f[N<<1][N][N],a[N][N],n;

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in; for(int i = 1;i <= n;i++) for(int j = 1;j <= n;j++) a[i][j] = in; memset(f,0xcf,sizeof f); f[0][0][0] = 0;
	for(int i = 1;i <= 2 * n - 1;i++)
		for(int j = max(i - n + 1,1);j <= n;j++)
			for(int k = max(i - n + 1,1);k <= n;k++){
				int c1 = a[j][i - j + 1],c2 = a[k][i - k + 1];
				int tc = c1 + c2; if(j == k) tc = c1;
				f[i][j][k] = max(f[i-1][j][k],max(f[i-1][j-1][k],max(f[i-1][j][k-1],f[i-1][j-1][k-1]))) + tc;
			}
	printf("%d\n",f[n + n - 1][n][n]);
	return 0;
}
